package aor2.cpu.blockcontrol.horizontal;

//import aor2.components.AlushiftOperation;
import java.util.ArrayList;

import aor2.cpu.blockcontrol.MicroMemory;
//import aor2.cpu.blockinterface.InterfaceBlock;
//import aor2.cpu.blockoperation.AlushiftXYM1;
//import aor2.cpu.blockregisters.InstructionRegister;

/**
 * mikromemorija sa mikroinstrukcijama sa horizontalnim kodiranjem i dva tipa
 * mikroinstrukcija
 * 
 * @author Moxi
 * 
 */
public class MMHorizontalType2 extends MicroMemory {

	private static MMHorizontalType2 singleton = null;
	private ArrayList<MicroInstructionHorizontal> instructions = new ArrayList<MicroInstructionHorizontal>();

	public static MMHorizontalType2 getInstance() {
		if (singleton == null) {
			singleton = new MMHorizontalType2();
		}
		return singleton;
	}

	private MMHorizontalType2() {
		// super();
		// MicroInstructionHorizontal mi;
		//
		// InterfaceBlock interfaceBlock = InterfaceBlock.getInstance();
		// AlushiftXYM1 alu = AlushiftXYM1.getInstance();

		// samo za test
		// GPRegisters.R7.setState(11);

		MicroInst2LoaderParser p = new MicroInst2LoaderParser();
		instructions = p.getInstructions();
		for (int i = 0; i < instructions.size(); i++) {
			addMicroInstruction(i, instructions.get(i));
		}
		// long step = 0;

		// //step00
		// mi = new MicroInstructionHorizontal(step++);
		// mi.addSources(GPRegisters.R7);
		// mi.addDestinations(interfaceBlock.mar(),alu.x());
		// mi.addSignals("mxMar");
		// addMicroInstruction(step-1,mi);
		//
		// //step01
		// mi = new MicroInstructionHorizontal(step++);
		// mi.addSources(alu);
		// mi.addDestinations(GPRegisters.R7);
		// mi.setOperation(AlushiftOperation.inc);
		// addMicroInstruction(step-1,mi);
		//
		// //step02
		// mi = new MicroInstructionHorizontal(step++);
		// mi.addSignals("read");
		// mi.addDestinations(interfaceBlock);
		// mi.setOperation(AlushiftOperation.inc);
		// addMicroInstruction(step-1,mi);
		//
		// //step03
		// mi = new MicroInstructionHorizontal(step++);
		// mi.addSources(interfaceBlock.mbr());
		// mi.addDestinations(InstructionRegister.IR0);
		// addMicroInstruction(step-1,mi);

	}
}
